package blq.ssnb.redbagaide.util;

import android.content.Context;

import com.blq.snblib.util.MyPreferences;

import blq.ssnb.redbagaide.constant.PListConstant;

/**
 * ================================================
 * 作者: SSNB
 * 日期: 2016/9/27
 * 描述:
 * 添加描述
 * ================================================
 */
public class RecordPList {

    private static RecordPList pList;
    private MyPreferences preferences;
    private RecordPList(Context context){
        preferences = new MyPreferences(context, PListConstant.RECORD_FILE_NAME);
    }

    public static RecordPList singleton(Context context){
        if(pList==null){
            synchronized (RecordPList.class){
                if(pList==null){
                    pList = new RecordPList(context);
                }
            }
        }
        return pList;
    }

    public void addInfo(String user,String money,String detail){
        String users = preferences.readString(PListConstant.RECORD_KEY_USER);
        preferences.save(PListConstant.RECORD_KEY_USER,users+"##"+user);

        String moneys = preferences.readString(PListConstant.RECORD_KEY_MONEY);
        preferences.save(PListConstant.RECORD_KEY_MONEY,moneys+"##"+money);
        String details = preferences.readString(PListConstant.RECORD_KEY_DETAIL);
        preferences.save(PListConstant.RECORD_KEY_DETAIL,details+"##"+detail);

    }

}
